/********************************************************************
	created:	2008/05/31
	created:	31:5:2008   23:14
	filename: 	x:\Lensow\Loplayer\src\app\SkinControl.h
	file path:	x:\Lensow\Loplayer\src\app
	file base:	SkinControl
	file ext:	h
	author:		Dean
	
	purpose:	
*********************************************************************/
#pragma once

class CSkinWnd;

// CSkinControl
class CSkinControl : public CObject
{
	DECLARE_DYNAMIC(CSkinControl)
public:
	CSkinControl();
	virtual ~CSkinControl();

	enum AlignFlag {
		None		= -1,
		TopLeft		= 0,
		BottomLeft	= 1,
		TopRight	= 2,
		BottomRight	= 3,
		TopCenter	= 4,
		BottomCenter= 5,
	};

	BOOL CreateCtrl(CSkinWnd*,
		LPCTSTR lpszCmd, 
		LPCTSTR lpszImg, 
		const CPoint& pt, 
		AlignFlag eFlag, 
		CWnd* pParentWnd, 
		UINT nID);

	void DrawControl(Gdiplus::Bitmap* pbmWnd);

	UINT GetCtrlID() const {return m_nID;}
protected:
	virtual BOOL CreateInternal(const RECT& rect, CWnd* pParentWnd, UINT nID) = 0;
	virtual BOOL LoadSkinImage(LPCTSTR lpszFilename) = 0;
	virtual void DrawIt (Gdiplus::Bitmap* pbmWnd, const RECT& rect) = 0;

	virtual CRect GetPlacement(const INT cxFrame, const INT cyFrame);

	void UpdateSkin ();
	void FireEvent (const CComVariant& vEvent);
protected:
	CSkinWnd*	m_pSkinWnd;
	CString		m_strCommandName;
	CPoint		m_Offset;
	AlignFlag	m_Align;
	UINT		m_nID;
	INT	m_cxBorder, m_cyBorder;
};


